<?php session_start() ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Adopt a Dog from the Kalamazoo Animal Rescue</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<? include("includes/head.inc");  ?>
</head>

<body>

<!--initial body width and height set up  -->
<div id="bodywidth">
<? include("includes/header.inc");  ?>
<? include("includes/leftmenu.inc");  ?>

<!-- place wide2column below -->
<div id="wide2column"><BR><BR><BR>
<CENTER><H2>Adoptable Dogs & Puppies</H2></CENTER>
<BR>

  <!-- Rolled out for testing 3-18-02 -->

<b>Please fill out our <A HREF="forms/dogadopt.php">online application form</A> if you are interested in adopting a dog or puppy. <font color = #ff00ff>Please be patient with us. We are all volunteers who donate our time.</b></font> <HR WIDTH="95%" ALIGN=CENTER>

<!-- Would you like an email notice the day a new pet is added to the web site?  Then <a href="karnews.htm">subscribe to kar-Friends</a>. Please understand that we are not able to keep a waiting list. --><BR>

<p style="margin-left:20px;font-size:124%;font-weight:bold;">
Select the picture for a larger image and detailed description.
</p>
<BR>

<?php
include("./includes/db.php");
include("./includes/count.php");				

// Connect to the database server
dbConnect('kar_web1');   	// Use function in db.php to connect

$numresults = @mysql_query("SELECT * FROM dogs  WHERE pet_status='v'");
if (!$numresults) {	
  echo("<p>Error performing query in Display Pets page: " . mysql_error() . "</p>");
  exit();
}

$num_to_display=20;  			//  how many animals we want displayed per page
$num_columns=5;				// how many columns we want those split between

$num_pets=mysql_num_rows($numresults); // how many total animals are actually available

if (empty($starting_num)){	// if this is our first page, then start at 0
	$starting_num=0;
} //  end if
/*
if (!$my_rand) 		// if $my_rand doesn't exist (wasn't passed from another page)
{
	$my_rand = rand();
}
*/
// We end up passing this random seed to subsequent pages so that the same 
// pets will not be shown again on another page

//$result = @mysql_query("SELECT * FROM dogs, petPics 
//				   pet_status='v' AND pets.pet_id=petPics.pet_id 
//				   ORDER BY rand($my_rand)
//				   LIMIT $starting_num,$num_to_display");


$result = @mysql_query("SELECT * FROM dogs WHERE pet_status='v'   
				   AND TO_DAYS(NOW()) - TO_DAYS(pet_DOB) > 210
				   LIMIT $starting_num,$num_to_display");


$count =mysql_num_rows($result);  // how many we have for this page
$pet_type = 'dogs';
//printf('Last MySQL Error was: (%s) - "%s"',mysql_errno(),mysql_error()); //kf error check
displayPageLinks($num_pets, $num_to_display, $starting_num, $pet_type, 0);


for ($i = 1; $i <= $count; $i++ ) {    	// loop for number of animals in this set
	$pet_record = mysql_fetch_array($result);
	$temp_id = $pet_record["tagNum"];
	$name = $pet_record["pet_name"];
	$special = $pet_record["spec_need"];
	$noPhotos = $pet_record["noPhotos"];

	//  Query Pet Photos separately in case there is not a record of photos for this pet
	$pics = @mysql_query("SELECT thumb, pic1, pic2, pic3 FROM dogs WHERE tagNum ='$temp_id'");
	$pet_pics = mysql_fetch_array($pics);

	if ($noPhotos) {
		$thumb = 'noPhotos.gif';	// this file is in both the dog and cat thumbnail folders
		} else {
		$thumb = $pet_pics["thumb"];
		}
	/*
	
	if ($pet_record["pet_type"] == 'c'):	// Set path to look in cat or dog images
		$path = "http://02d2e0a.netsolhost.com/images/cats/thmbnail/";
		$type = "cat";
	else:
		$path = "http://02d2e0a.netsolhost.com/images/dogs/thmbnail/";
		$type = "dog";
	endif;
	*/
	$path = "http://02d2e0a.netsolhost.com/images/dogs/thmbnail/";
	$type = "dog";

	echo ("<div class =\"float\">");   // no matter what start display pet thumbnails with this

							// display pet thumbnail image and name
	echo("<a href='pets2.php?displaypet=$temp_id'><img SRC=\"". $path . $thumb . "\" align=\"$align\"  alt=\"$name\"  width=\"75\" height=\"75\"></a>" );

 	echo("<BR><p>");   //move below photo and start caption paragraph

	if ($special=='1'):		// special needs
		echo("<img SRC=\"http://02d2e0a.netsolhost.com/images/sneed3.gif\"  HSPACE=0 ALIGN=\"TOP\" WIDTH=\"17\" HEIGHT=\"17\" ALT=\"Sp Needs\">" . $name . "</p></div>");
	else:
		echo($name . "</p></div>");
	endif;

	if ( ($i%$num_columns) == 0):	// if it's the last slot in the row, end the row
//		echo ("</TD></TR>");
		echo("<div class=\"clearit\"></div>");
//	else:
//		echo ("</TD>");
	endif;
 
}  // end for 

	echo("<div class=\"clearit\"></div>");    // move down to next line after all images posted

displayPageLinks($num_pets, $num_to_display, $starting_num, $pet_type);
?>



<img SRC="http://02d2e0a.netsolhost.com/images/sneed3.gif"  HSPACE=0 ALIGN="TOP" WIDTH="17" HEIGHT="17" ALT="Special Needs"> denotes Special Needs



<BR><BR>



<CENTER>

<HR>

<TABLE WIDTH="100%"> 

<TR><TD>

<FONT SIZE="+1"><B>KAR may have more dogs and puppies than are shown here.&nbsp;&nbsp;Fill out the <A HREF="forms/dogadopt.php">online application form</A> to be contacted about a possible perfect match for you.</B></FONT>

</TD>

<TD>

<!-- Visit our <A HREF="http://02d2e0a.netsolhost.com/figures.php#Adopteds">"successes"</A> page to see who has found great new homes. --></TD>

</TR>

</TABLE>

</CENTER>



<BR>



</div>



<? include("./includes/footer.inc");  ?>



<!--tag below ends bodywidth div -->

</div>

</body>

</html>

